function priceandvol(x)
%PRICEANDVOL Price and volume chart.
%   PRICEANDVOL(X) plots the asset data displaying the open, high, low and 
%   closing prices on one axis and the volume on a second axis.    X is the
%   asset data where the columns are date, open, high, low, close and
%   volume.
%
%   See also BOLLING, CANDLE, HIGHLOW, LINEBREAK, MOVAVG, POINTFIG, RENKO, KAGI, VOLAREA.

%	Copyright 1995-2007 The MathWorks, Inc.
%	$Revision: 1.1.6.2 $   $Date: 2007/11/22 16:40:03 $

%Create the OHLC chart
a1 = subplot(2,1,1);
highlow(x(:,3),x(:,4),x(:,5),x(:,2))

%Set the xdata to the dates
c1 = get(a1,'children');
x1 = get(c1,'xdata');
for i = 1:length(x1)
  if ~isnan(x1(i))
    %x1(i) = x(round(x1(i)),1);
    modval = round(mod(x1(i),1)*10);
    
    switch modval
      case 6
        x1(i) = x(round(x1(i)),1) - 0.4;
      case 4 
        x1(i) = x(round(x1(i)),1) + 0.4;
      otherwise
        x1(i) = x(round(x1(i)),1);
    end
  end
end
set(c1,'xdata',x1)
datetick
xmin = min(x(:,1));
xmax = max(x(:,1));
set(a1,'Xlim',[xmin-1 xmax+1],'Tag','priceandvolchart1') 
grid on

%Create the volume chart
a2 = subplot(2,1,2);
bar(x(:,1),x(:,6))
datetick
set(a2,'Xlim',[xmin-1 xmax+1],'Tag','priceandvolchart2')
grid on
